--- title: "平方序列" created: 2025-11-28 tags: - 算法 --- # 平方序列 ## 题目 [平方序列](https://www.lanqiao.cn/paper/3845/problem/808/) ![[image-56c8f6b6.png]] ## 思路分析 直接枚举就行了 ![[image-dd2f5df4.png]] ## 代码实现 ```cpp #include using namespace std; #define endl '\n' int res=1e6; int main() { ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); for(int x=2019+1;x<100000;x++){ for(int y=x+1;y<100000;y++){ if(2*x*x==2019*2019+y*y){ res=min(res,x+y); } } } cout<